file(GLOB_RECURSE source_file
    drivers/*.c
)

# 获取所有子目录作为包含路径
file(GLOB include_dirs
    drivers/*/
)
# 过滤出只有目录的条目
foreach(dir ${include_dirs})
    if(IS_DIRECTORY ${dir})
        list(APPEND valid_include_dirs ${dir})
    endif()
endforeach()

list(APPEND valid_include_dirs drivers)

idf_component_register(SRCS "main.c" ${source_file}
                    INCLUDE_DIRS "." ${valid_include_dirs})
